#ifndef COVERAGEMODELHTMLADAPTER_H
#define COVERAGEMODELHTMLADAPTER_H

#include <QDateTime>

#include <adapterinterface.h>
#include <staticmodel.h>
#include <dynamicmodel.h>
#include <coveragemodel.h>

class CoverageModelHTMLAdapter : public QObject,
                                 public CoverageModelHTMLAdapterPluginInterface
{
    Q_OBJECT
    Q_INTERFACES(PluginInterface CoverageModelHTMLAdapterPluginInterface)

public:
    CoverageModelHTMLAdapter(QObject * parent = 0);

    QString name()const;
    QString description()const;
    bool saveModel(CoverageModel * model, const QDir & dir, const QString & version);

private:
    QMultiMap <QString, ARSWorkflowObject *> createCrMap(const ARSWorkflowObjectList & list, const QDateTime & versionStartDate);
    bool createMainPage(CoverageModel * model, const QDir & dir, const QDateTime & versionStartDateTime, const QMultiMap <QString, ARSWorkflowObject *> & crMap);
    bool createWorkflowPage(CoverageModel * model, const QDir & dir, const QDateTime & versionStartDateTime, const QMultiMap <QString, ARSWorkflowObject *> & crMap);
    bool createHomelessWorkflowPage(CoverageModel * model, const QDir & dir, const QDateTime & versionStartDateTime, const QMultiMap <QString, ARSWorkflowObject *> & crMap);
    bool createTestcaseDetailsPage(CoverageModel * model, const QDir & dir, const QDateTime & versionStartDateTime, const QMultiMap <QString, ARSWorkflowObject *> & crMap);
    ARSWorkflowObjectList createHomelessObjectsList(const ARSWorkflowObjectList & list, QMultiMap <QString, ARSWorkflowObject *> crMap);
    QStringList createTestcaseList(const QList<const DynamicModel *> & modelList);
    QMultiMap<QString, ARSWorkflowObject *> createTestObjectMap(const WorkflowCoverageMap & coverageMap, QStringList testcaseList) const;
    QStringList relatedCRs(const QStringList & changeHistory, const QDateTime & versionStartDateTime) const;
    QString attachCSS(const QString& html);
};

#endif // COVERAGEMODELHTMLADAPTER_H
